<include file="public/header" title="我的订单" body="g4"/>
<include file="public/header_nav" title="我的订单" href="{:U('/Mobile/User/index')}"/>
<div class="tit-flash-sale p mytit_flash">
    <div class="maleri30">
        <ul class="">
            <li <if condition="$Request.param.type eq ''">class="red"</if>>
                <a href="{:U('/Mobile/Order/order_list')}" class="tab_head">全部订单</a>
            </li>
            <li id="WAITPAY" <if condition="$Request.param.type eq 'WAITPAY'">class="red"</if>">
                <a href="{:U('/Mobile/Order/order_list',array('type'=>'WAITPAY'))}" class="tab_head" >待付款</a>
            </li>
            <li id="WAITSEND" <if condition="$Request.param.type eq 'WAITSEND'">class="red"</if>>
                <a href="{:U('/Mobile/Order/order_list',array('type'=>'WAITSEND'))}"  class="tab_head">待发货</a>
            </li>
            <!--<li id="WAITRECEIVE"><a href="{:U('/Mobile/User/order_list',array('type'=>'WAITRECEIVE'))}"  class="tab_head <if condition="$Request.param.type eq 'WAITRECEIVE'">on</if>">待收货</a></li>-->
            <li id="WAITCCOMMENT"  <if condition="$Request.param.type eq 'FINISH'">class="red"</if>>
                <a href="{:U('/Mobile/Order/order_list',array('type'=>'FINISH'))}" class="tab_head">已完成</a>
            </li>
        </ul>
    </div>
</div>

    <!--订单列表-s-->
    <div class="ajax_return">
        <if condition="count($lists) eq 0">
            <!--没有内容时-s--->
            <div class="comment_con p">
                <div class="none">
                    <img src="__STATIC__/images/none2.png">
                    <br><br>
                    抱歉未查到数据！
                    <div class="paiton">
                        <div class="maleri30">
                            <a class="soon" href="/"><span>去逛逛</span></a>
                        </div>
                    </div>
                </div>
            </div>
            <!--没有内容时-e--->
        </if>
        <volist name="lists" id="list">
            <div class="mypackeg ma-to-20 getmore">
                <div class="packeg p">
                    <div class="maleri30">
                        <div class="fl">
                            <h1><span></span><span class="bgnum"></span></h1>
                            <p class="bgnum"><span>订单编号:</span><span>{$list.order_sn}</span></p>
                        </div>
                        <div class="fr">
                            <span>{$list['order_status_desc']}</span>
                        </div>
                    </div>
                </div>
                <div class="shop-mfive p">
                    <div class="maleri30">
                        <foreach  name="list.goods_list" item="good">
                            <div class="sc_list se_sclist paycloseto">
                                <a <if condition="$list.receive_btn eq 1">href="{:U('/Mobile/Order/order_detail',array('id'=>$list['order_id'],'waitreceive'=>1))}" <else/> href="{:U('/Mobile/Order/order_detail',array('id'=>$list['order_id']))}"</if>>
                                <div class="shopimg fl">
                                    <img src="{$good[goods_id]|goods_thum_images=200,200}">
                                </div>
                                <div class="deleshow fr">
                                    <div class="deletes">
                                        <span class="similar-product-text">{$good[goods_name]|getSubstr=0,20}</span>
                                    </div>
                                    <div class="deletes">
                                        <span class="similar-product-text">{$good.spec_key_name}</span>
                                    </div>
                                    <div class="prices  wiconfine">
                                        <p class="sc_pri"><span>￥</span><span>{$good[member_goods_price]}</span></p>
                                    </div>
                                    <div class="qxatten  wiconfine">
                                        <p class="weight"><span>数量</span>&nbsp;<span>{$good[goods_num]}</span></p>
                                       
                                    </div>
                                    <div class="buttondde">
                                        <if condition="($list[return_btn] eq 1) and ($good[is_send] lt 2)">
                                            <a href="{:U('Mobile/Order/return_goods',['rec_id'=>$good['rec_id']])}">申请售后</a>
                                        </if>
                                    </div>
                                </div>
                                </a>
                            </div>
                        </foreach>
                    </div>
                </div>
                <div class="shop-rebuy-price p">
                    <div class="maleri30">
                <span class="price-alln">
                    <!--<span class="red">￥{$list['order_amount']}</span><span class="threel">共{$list.goods_list|count}件</span>-->
                    <span class="red">￥{$list['total_amount']}</span><span class="threel" id="goodsnum">共{$list.count_goods_num}件</span>
                    <!--if condition="$list['pay_code'] eq 'cod'"><i class="tits-ions qxatten-ions">货到付款</i></if -->
                </span>
                        <if condition="$list.pay_btn eq 1">
                            <a class="shop-rebuy paysoon" href="{:U('Mobile/Cart/cart4',array('order_id'=>$list['order_id']))}">立即付款</a>
                        </if>
                        <if condition="$list.cancel_btn eq 1">
                            <if condition="$list.pay_status eq 0">
                                <a class="shop-rebuy " onClick="cancel_order({$list.order_id})">取消订单</a>
                            </if>
                            <if condition="$list.pay_status eq 1">
                                <a class="shop-rebuy" href="{:U('Order/refund_order', ['order_id'=>$list['order_id']])}">取消订单</a>
                            </if>
                        </if>
                        <if condition="$list.receive_btn eq 1">
                            <a class="shop-rebuy paysoon" onclick="orderConfirm({$list.order_id})">确认收货</a>
                        </if>
                        <if condition="$list.comment_btn eq 1">
                            <a class="shop-rebuy" href="{:U('/Mobile/Order/comment')}">评价</a>
                        </if>
                        <if condition="$list.shipping_btn eq 1">
                            <a class="shop-rebuy" class="shop-rebuy" href="{:U('Mobile/Order/express',array('order_id'=>$list['order_id']))}">查看物流</a>
                        </if>
                    </div>
                </div>
            </div>
        </volist>
    </div>
    <!--订单列表-e-->
<script type="text/javascript" src="__STATIC__/js/sourch_submit.js"></script>
<script type="text/javascript">
    /**
     * 取消订单
     */
    function cancel_order(id){
        if(!confirm("确定取消订单?"))
            return false;
        $.ajax({
            type: 'GET',
            dataType:'JSON',
            url:"/index.php?m=Mobile&c=Order&a=cancel_order&id="+id,
            success:function(data){
                if(data.code == 1){
                    layer.open({content:data.msg,time:1});
                    location.href = "/index.php?m=Mobile&c=Order&a=order_list";
                }else{
                    layer.open({content:data.msg,time:2});
                    location.href = "/index.php?m=Mobile&c=Order&a=order_list";
                    return false;
                }
            },
            error:function(){
                layer.open({content:'网络异常，请稍后重试',time:3});
            },
        });
    }

    /**
     * 确定收货
     */
    function orderConfirm(id){
        if(!confirm("确定收到该订单商品吗?"))
            return false;
        location.href = "/index.php?m=Mobile&c=Order&a=order_confirm&id="+id;
    }

    var  page = 1;
    /**
     *加载更多
     */
    function ajax_sourch_submit()
    {
        page += 1;
        $.ajax({
            type : "GET",
            url:"/index.php?m=Mobile&c=Order&a=order_list&type={$Request.param.type}&is_ajax=1&p="+page,//+tab,
            success: function(data)
            {
                if(data == '')
                    $('#getmore').hide();
                else
                {
                    $(".ajax_return").append(data);
                    $(".m_loading").hide();
                }
            }
        });
    }
</script>
</body>
</html>
